﻿namespace AjLogo.Console
{
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using AjLogo;
    using AjLogo.Compiler;
    using AjLogo.Language;

    public class Program
    {
        public static void Main(string[] args)
        {
            Machine machine = new Machine();
            BindingEnvironment environment = new BindingEnvironment(machine);

            Parser compiler = new Parser(System.Console.In);

            while (true)
            {
                try
                {
                    IExpression expression = compiler.CompileExpression();
                    expression.Evaluate(environment);
                }
                catch (System.Exception ex)
                {
                    System.Console.WriteLine(ex.Message);
                }
            }
        }
    }
}
